/**
 * 
 */
package sort.ui.components;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.Collection;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 * @author masaru-gotou
 *
 */
public class SortControlWindowBuilder {
	private JFrame frame;
	private SelectorPanel selector;
	private String argonames[] = new String[0];
	private Collection<JButton> buttons = new ArrayList<JButton>();
	private SortAnimationPanel sort_anime;
//	private Container content;
	
	public SortControlWindowBuilder(String title) {
		this.frame = new JFrame(title);
	}
	
	public void setSelectorPanel() {
		selector = new SelectorPanel();
	}
	public void setAlgorithmNames(String[] names) {
		argonames = names;
	}
	public void setButton() {
		buttons.add(new JButton("Init"));
		buttons.add(new JButton("Start"));
	}
	public void setSortAnimationPanel() {
		sort_anime = new SortAnimationPanel();
	}
	
	public JFrame build() {
		selector.setAlgorithmNames(argonames);
		
		JPanel cpanel = new JPanel(new FlowLayout());
		for (JButton b : buttons) {
			cpanel.add(b);
		}
		Container content = frame.getContentPane();
		content.setLayout(new BorderLayout());
		content.add(BorderLayout.NORTH, selector);
		content.add(BorderLayout.CENTER, cpanel);
		content.add(BorderLayout.SOUTH, sort_anime);
		
		return frame;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
